﻿@inherits OperationDialogBase<int, bool, UserCenterResource>
@if (_currentUser != null)
{
    <div class="baseView">
        <div class="left" style="min-width: 310px;">
            <Form Layout="vertical"
                  OnFinish="SaveUserBaseInfo"
                  Model="@_currentUser"
                  Context="model" 
                  ValidateOnChange="true">
                <FormItem Label="@Localizer[nameof(SharedLocalResource.Avatar)]">
                    <Tooltip Placement="Placement.LeftTop" Title="@Localizer[nameof(UserCenterResource.ClickUpdateAvatar)]">
                        <a @onclick="_ => OnAvatarClick(model)">
                            <Avatar Src="@model.Avatar" />
                        </a>
                    </Tooltip>
                </FormItem>
                <FormItem Label="@Localizer[nameof(UserCenterResource.NickName)]">
                    <Input @bind-Value="@model.NickName" />
                </FormItem>
                <FormItem Label="@Localizer[nameof(UserCenterResource.Gender)]">
                    <RadioGroup @bind-Value="@(model.Gender)">
                        @foreach (var gitem in EnumHelper.EnumToDictionary<Gender>())
                        {
                            <Radio Value="@(gitem.Key)">@Localizer[gitem.Value]</Radio>
                        }
                    </RadioGroup>
                </FormItem>
                <FormItem>
                    <Button HtmlType="submit" Type="primary" Loading="_saveBtnLoading">
                        @Localizer[nameof(SharedLocalResource.Save)]
                    </Button>
                </FormItem>
            </Form>
        </div>
    </div>
}